@echo off
:: 创建一个 VBScript 来隐藏控制台窗口
echo Set WshShell = CreateObject("WScript.Shell") > %temp%\hidden.vbs
echo WshShell.Run chr(34) ^& "%~f0" ^& chr(34) ^& " hidden", 0 >> %temp%\hidden.vbs
echo Set WshShell = Nothing >> %temp%\hidden.vbs

if "%1" neq "hidden" (
    start /b wscript.exe "%temp%\hidden.vbs"
    exit
)

:: 激活虚拟环境
call py311\Scripts\activate.bat

:: 运行 labelImg.py
pythonw labelImg.py

:: 退出虚拟环境
call deactivate

:: 删除临时 VBScript 文件
del %temp%\hidden.vbs